{include 'common/header.html'}
<body>

<!-- header -->
<header>
<ul>
<li><a href="{$this->urlCreate('forum','section',array('id'=>$section['id']))}" style="z-index: 50;">{$section['name']}</a></li>
</ul>
</header>
<hr style="clear: both;height: 2px;margin: 0;padding: 0;" />

<!-- body -->
<div id="main">

<h1 style="text-align: center;font-size: 2em;">{$topic['title']}</h1>
<div id="box" style="text-align: center;letter-spacing: 1px;font-size: 0.5em;">
<span style="margin-right: 0.7em;">楼主：{if(checkVip($user['vip']))}<img src="{__STATIC__}/pic/vip.png" alt="VIP" title="VIP" style="border-radius: 100%;vertical-align: top;" />{/if}<b style="{if($user['vip']==1)}color:red;{/if}margin: 0 2px">{$user['user']}</b>({$user['id']})</span><span>发表时间：{F:dateFormat($topic['ptime'])}</span>
<span>阅读量：{$readcount}</span>
</div>

<div id="box" style="text-indent: 2em;padding: 3px;">
{F:nl2br($topic['content'])}

{if(!empty($uploads))}
<div id="box" style="text-indent: 0px;">
<p style="border-bottom: 1px solid #eee;">附件<span style="font-size: 0.7em;color: red;">(图片会自动显示)</span>：</p>
<ol style="list-style-position: inside;padding: 2px;">
{foreach $uploads as $upload}
{if(in_array(getExt($upload['name']),array('bmp','jpg','png','jpeg','gif')))}
<li style="margin: 0.5em 0px;"><img src="/{$upload['path']}" alt="{$upload['name']}" style="max-width: 100%;max-height: 100%;" /></li>
{else}
<li style="margin: 0.5em 0px;"><a href="{$this->urlCreate('download','topic',array('id'=>$upload['id']))}">{$upload['name']}</a></li>
{/if}
{/foreach}
</ol>
</div>
{/if}
</div>
{if($user['id']==$login_user['id'])}
<!--主题发布者的操作-->
<div id="box">
<a style="margin: 0px 3px;" href="{$this->urlCreate('increase','upload',array('id'=>$topic['id']))}">增加附件</a><a style="margin: 0px 3px;" href="{$this->urlCreate('change','topic',array('id'=>$topic['id']))}">修改</a>
</div>
{/if}

<div id="subtitle">回复列表</div>
<div id="box">
{if(empty($replys))}
<div id="tip">没人回复？赶紧抢沙发！</div>
{else}
<ul>
{foreach $replys as $key=>$reply}
<li>
{if($reply['uid']==$user['id'])}
<div style="background: url({__STATIC__}/pic/louzhu.png) no-repeat 100% 0;width:99%;min-height: 3em;border: 1px solid #eee;margin: 0.5em auto;padding: 1px;">
{else}
<div style="width:99%;min-height: 3em;border: 1px solid #eee;margin: 0.5em auto;padding: 1px;">
{/if}

<div style="width: 100%;border-bottom: 1px dashed #eee;">
<span>{$key+1}楼</span>
<a href="#" style="text-decoration: none;" onclick="atUserByID('{$reply['uid']}');return false;">@</a><b style="{if(checkVipByID($reply['uid']))}color: red;{/if}">{$this->getUserByID($reply['uid'])}</b><span style="font-size: 0.7em;">{F:dateFormat($reply['ptime'])}</span>
</div>
<div style="letter-spacing: 1px;text-indent: 2em;vertical-align: middle;">
{F:nl2br($reply['content'])}
</div>
</div>
</li>
{/foreach}
</ul>
{/if}
</div>

<div id="box">
{if($login_user)}
<form action="{$this->urlCreate('increase','reply',array('id'=>$topic['id']))}" method="post">
<textarea id="atuser" name="content" style="display: block;word-wrap: break-word;min-height: 80px;outline: none;padding: 3px;resize: vertical;margin: 0.5em auto;width: 97%;" placeholder="回复"></textarea>
<input type="submit" name="submit" value="回复" style="display: block;width: 6em;margin: 6px auto;height: 3em;" />
</form>
{else}

<p style="color: #EE7700;text-align: center;">您未登录，无权回复。请<a href="{$this->urlCreate('user','login')}">登录</a>/<a href="{$this->urlCreate('user','register')}">注册</a>后回复。</p>

{/if}
</div>
</div>
</div>

<!-- footer -->
{include 'common/footer.html'}

</body>
</html>